package rad.framework.mda.generator.template.main.webapp;

import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.*;
import java.util.*;
import rad.framework.mda.generator.util.*;

public class HelpPanel
{
  protected static String nl;
  public static synchronized HelpPanel create(String lineSeparator)
  {
    nl = lineSeparator;
    HelpPanel result = new HelpPanel();
    nl = null;
    return result;
  }

  public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
  protected final String TEXT_1 = "<!DOCTYPE composition PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" " + NL + "                             \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">" + NL + "<ui:composition " + NL + "\txmlns=\"http://www.w3.org/1999/xhtml\"" + NL + "\txmlns:ui=\"http://java.sun.com/jsf/facelets\"" + NL + "\txmlns:h=\"http://java.sun.com/jsf/html\">" + NL + "" + NL + "\t<p><h:outputText value=\"#{messages['";
  protected final String TEXT_2 = "Doc']}\" /></p>" + NL + "\t<hr class=\"rad-framework-horizontal-separator\" />" + NL + "\t<p>" + NL + "\t<ul>          ";
  protected final String TEXT_3 = NL + "\t\t<li>#{messages['";
  protected final String TEXT_4 = "_";
  protected final String TEXT_5 = "']} - #{messages['";
  protected final String TEXT_6 = "_";
  protected final String TEXT_7 = "Doc']}</li>";
  protected final String TEXT_8 = NL + "\t</ul>          " + NL + "\t</p>" + NL + "</ui:composition>" + NL;
  protected final String TEXT_9 = NL;

  public String generate(Object argument)
  {
    final StringBuffer stringBuffer = new StringBuffer();
    Class uml2Class = (Class) argument;
    stringBuffer.append(TEXT_1);
    stringBuffer.append(uml2Class.getName());
    stringBuffer.append(TEXT_2);
    for (Iterator<Property> j=ClassHelper.getAllSimpleProperties(uml2Class); j.hasNext();) { Property property = j.next();
    stringBuffer.append(TEXT_3);
    stringBuffer.append(uml2Class.getName());
    stringBuffer.append(TEXT_4);
    stringBuffer.append(property.getName());
    stringBuffer.append(TEXT_5);
    stringBuffer.append(uml2Class.getName());
    stringBuffer.append(TEXT_6);
    stringBuffer.append(property.getName());
    stringBuffer.append(TEXT_7);
    }
    stringBuffer.append(TEXT_8);
    stringBuffer.append(TEXT_9);
    return stringBuffer.toString();
  }
}
